package net.lainiao.toppic;

import com.rabbitmq.client.Channel;
import net.lainiao.MyConst;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * Created by Administrator on 2018/7/9.
 */
public class ProviderDemo {
    public static void main(String[] args) throws IOException, TimeoutException, InterruptedException {
        final Channel channel = MyConst.getChanel();
        channel.exchangeDeclare(MyConst.EName4, "topic");
        channel.queueDeclare(MyConst.QName41, false, false, true, null);
        channel.queueDeclare(MyConst.QName42, false, false, true, null);
        channel.queueBind(MyConst.QName41, MyConst.EName4, "Account.LoginOut");
        channel.queueBind(MyConst.QName42, MyConst.EName4, "Account.Login");
        channel.basicPublish(MyConst.EName4,"Account.Login",null,"用户登录".getBytes());
        channel.basicPublish(MyConst.EName4,"Account.LoginOut",null,"用户退出".getBytes());
        channel.close();
        MyConst.connection.close();
    }
}
